package com.qf.bank.exception;

import com.qf.bank.response.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author YaoJiXing
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ExceptionHandler
    public R globalExceptionHandler(Throwable t){
        log.error("全局异常已经捕获：{}",  t.getMessage());
        return R.createFAIL("服务器异常");
    }

}